<template>
    <svg aria-hidden="true" class="svg-icon" :font-size="fontSize">
      <use :xlink:href="symbolId" :fill="color" />
    </svg>
  </template>
  
  <script setup lang="ts">
  import { computed } from 'vue';
  
  const props = defineProps({
    prefix: {
      type: String,
      default: 'icon',
    },
    iconClass: {
      type: String,
      required: false,
    },
    color: {
      type: String,
      default: '',
    },
  fontSize:{
    type: String,
    default: '1px',
  }
  });
  
  const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
  </script>
  
  <style scoped>
  .svg-icon {
    width: 1em;
    height: 1em;
    fill: currentColor; /* 定义元素的颜色，currentColor是一个变量，这个变量的值就表示当前元素的color值，如果当前元素未设置color值，则从父元素继承 */
    overflow: hidden;
    vertical-align: middle;
  }
  </style>
  